﻿using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids;

namespace Ocean.His.MedicalInsurance.Data
{
    public class MedicalInsuranceFactory : IMedicalInsuranceFactory, ISingletonDependency
    {
        private MedicalInsuranceOption _medicalInsuranceOption;
        private IGuidGenerator _guidGenerator;
        public ILogger _logger;

        public MedicalInsuranceFactory(IOptions<MedicalInsuranceOption> medicalInsuranceOption
            , IGuidGenerator guidGenerator
            , ILogger<MedicalInsuranceBaseProvider> logger)
        {
            _logger = logger;
            _medicalInsuranceOption = medicalInsuranceOption.Value;
            _guidGenerator = guidGenerator;
        }

        public IMedicalInsurance CreateProxy()
        {
            var settlementTypeValue = _medicalInsuranceOption.SetlTypeCode;

            switch (settlementTypeValue)
            {
                case "shenyang": return new MedicalInsuranceShenYangProvider(_logger, _medicalInsuranceOption, _guidGenerator);
                case "dalian": return new MedicalInsuranceDaLianProvider(_logger, _medicalInsuranceOption, _guidGenerator);
                default : return new MedicalInsuranceTestProvider(_logger, _medicalInsuranceOption, _guidGenerator);
            }

            throw new NotImplementedException();
        }
    }
}
